{template 'common/header'}
<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
<ul class="nav nav-tabs">
  <li {if $opp == 'citysetup'}class="active"{/if}><a href="{php echo $this->createWebUrl('citysetup');}">信息库基本设置</a></li>
  <li {if $opp == 'cityclass'}class="active"{/if}><a href="{php echo $this->createWebUrl('cityclass');}">信息库信息分类</a></li>
  <li {if $opp == 'city_overrule'}class="active"{/if}><a href="{php echo $this->createWebUrl('city_overrule');}">信息顶置规则</a></li>
  <li {if $opp == 'citybase'}class="active"{/if}><a href="{php echo $this->createWebUrl('citybase');}">信息库信息管理</a></li>
  <li {if $opp == 'citybanner'}class="active"{/if}><a href="{php echo $this->createWebUrl('citybanner');}">信息库轮播图管理</a></li>
</ul>
</div>
<ul class="nav nav-tabs">

	<li {if $operation == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('citybanner',array('op' =>'display'))}">幻灯片</a></li>

	<li{if empty($citybanner['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('citybanner',array('op' =>'post'))}">添加幻灯片</a></li>

	{if !empty($citybanner['id']) &&  $operation == 'post'}<li  class="active"><a href="{php echo $this->createWebUrl('citybanner',array('op' =>'post','id'=>$citybanner['id']))}">编辑幻灯片</a></li>{/if}

</ul>

{if $operation == 'display'}

<div class="main panel panel-default">

	<div class="panel-body table-responsive">

		<table class="table table-hover">

			<thead class="navbar-inner">

				<tr>

					<th style="width:30px;">ID</th>

					<th>显示顺序</th>					

					<th>标题</th>

					<th>外链名片ID</th>

					<th >操作</th>

				</tr>

			</thead>

			<tbody>

				{loop $list $citybanner}

				<tr>

					<td>{$citybanner['id']}</td>

					<td>{$citybanner['displayorder']}</td>

					<td>{$citybanner['advname']}</td>

					<td>{$citybanner['link']}</td>

					<td style="text-align:left;">

						<a href="{php echo $this->createWebUrl('citybanner', array('op' => 'post', 'id' => $citybanner['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>

						<a href="{php echo $this->createWebUrl('citybanner', array('op' => 'delete', 'id' => $citybanner['id']))}"class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>

					</td>

				</tr>

				{/loop}

			</tbody>

		</table>

		{$pager}

	</div>

</div>

<script>

	require(['bootstrap'],function($){

		$('.btn').hover(function(){

			$(this).tooltip('show');

		},function(){

			$(this).tooltip('hide');

		});

	});

</script>

{elseif $operation == 'post'}

<div class="main">

	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>

		<input type="hidden" name="id" value="{$citybanner['id']}" />

		<div class="panel panel-default">

			<div class="panel-heading">

				幻灯片设置

			</div>

			<div class="panel-body">

				<div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" name="displayorder" class="form-control" value="{$citybanner['displayorder']}" />

					</div>

				</div>

				<div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>幻灯片标题</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" id='advname' name="advname" class="form-control" value="{$citybanner['advname']}" />

					</div>

				</div>

				<div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片图片</label>

					<div class="col-sm-9 col-xs-12">

						{php echo tpl_form_field_image('thumb', $citybanner['thumb'])}
                        
                        <span class="help-block">图片比例：200：750</strong></span>

					</div>

				</div>

				 <div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片外链名片ID</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" name="link" class="form-control" value="{$citybanner['link']}" />

					</div>

				</div>
                
                <div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">外链小程序appid</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" name="wx_appid" class="form-control" value="{$citybanner['wx_appid']}" />
                        <font style="color:red;"></font>
             <span class="help-block"><font style="color:red;">打开同一公众号下关联的另一个小程序。（注：必须是同一公众号下，而非同个 open 账号下）</font></strong></span>
             <span class="help-block">如不需跳转绑定小程序，这两项留空；留空跳转名片ID;</strong></span>
					</div>

				</div>
               <div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">外链小程序页面地址</label>

					<div class="col-sm-9 col-xs-12">

						<input type="text" name="wx_path" class="form-control" value="{$citybanner['wx_path']}" />
                        
                        <span class="help-block">跳转到小程序哪个页面，如：（pages/index/index）；留空默认外部小程序首页</strong></span>

					</div>

				</div>
               <div class="form-group">

			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">起止时间</label>

			<div class="col-sm-8 col-lg-9 col-xs-12">

				{php echo tpl_form_field_daterange('activity',array('start'=>date('Y-m-d H:i:s',empty($citybanner['start_time'])?time():$citybanner['start_time']),'end'=>date('Y-m-d H:i:s',empty($citybanner['end_time'])?time()+3600*5:$citybanner['end_time'])),true);}

				<span class="help-block"><font style="color:red;">幻灯片广告起止时间</font></strong></span>

			</div>

		</div>

				<div class="form-group">

					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>

					<div class="col-sm-9 col-xs-12">

						<label class='radio-inline'>

							<input type='radio' name='enabled' value=1' {if $citybanner['enabled']==1}checked{/if} /> 是

						</label>

						<label class='radio-inline'>

							<input type='radio' name='enabled' value=0' {if $citybanner['enabled']==0}checked{/if} /> 否

						</label>

					</div>

				</div>

			</div>

		</div>

<div class="form-group col-sm-12">

	<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />

	<input type="hidden" name="token" value="{$_W['token']}" />

	</div>

	</form>

</div>

<script language='javascript'>

	function formcheck() {

		if ($("#advname").isEmpty()) {

			Tip.focus("advname", "请填写幻灯片名称!");

			return false;

		}

		return true;

	}

</script>

{/if}

{template 'common/footer'}